#for 60cm the scale is 0.556155 arcsec/pix
#new 2k*2k CCD for 60cm is 0.563 arcsec/pix
#the index file is index-4203-*.fits
fitfile=$1
newfitfile=`echo $fitfile | sed 's/.fit/.new/g'`
#solve-field -O --use-sextractor -scale -H 0.7 -L 0.5 -u app $fitfile
objra=`gethead $fitfile "objctra" | awk '{print($1)}'`
objctdec=`gethead $fitfile "objctdec" | awk '{print($1)}'`
solve-field -p -O --use-sextractor -scale -H 0.6 -L 0.5 -u app -3 $objra -4 $objctdec -5 1  $fitfile
if test -r $newfitfile
then
	echo "Astrometry is finished"
	mv $newfitfile $fitfile
fi
 rm -rf *axy *corr *png *xyls *.match *rdls *solved *.wcs
